(function() {
	var skill = {
		recommendAccToMoney: function(acc) {
			var recommend_config = this.getRecommendConfig();
			for (var i = recommend_config.length - 1, config; config = recommend_config[i]; i -= 1) {
				var max_price = parseFloat(config.max_price) || 0;
				if (max_price <= acc) {
					var rate = parseFloat(config.rate) || 0;
					var money = acc * rate;
					break;
				}
			}
			return money;
		},
		recommendMoneyToAcc: function(money) {
			money = parseFloat(money) || 0;
			recommend_config = this.getRecommendConfig();
			var acc = 0;

			for (var i = recommend_config.length - 1, config; config = recommend_config[i]; i -= 1) {
				var max_price = parseFloat(config.max_price) || 0;
				var rate = parseFloat(config.rate) || 0;
				var _money = max_price * rate;
				if (_money <= money) {
					var acc = money / rate;
					break;
				}
			}
			return acc;
		},
		state_shenqingduihuanzhong_to_shangjiayijingfukuan: function(user_id) {
			var bus_user_bind = BusUserBindCon.get(BusUserBindCon.build({
				bus_id: this._id,
				user_id: user_id
			}));
			if (!bus_user_bind.state) {
				bus_user_bind.state = BusUserBindCon.STATE.未申请兑换;
			}
			if (bus_user_bind.state == BusUserBindCon.STATE.申请兑换中) {
				bus_user_bind._nextFlowStatus();
			} else {
				throwCusError("兑现所在状态无法进行相应转换");
			}
			bus_user_bind.user = UserCon.get(bus_user_bind.user_id);
			bus_user_bind.bus = BusCon.get(bus_user_bind.bus_id);
			return bus_user_bind;
		},
	};
	module.exports = skill;

	var db = require("../db/index");
	var DomainCon = require("../domain/_con");
	var GoodsCon = require("../goods/_con");
	var UserCon = require("../../core/user/_con");
	var BusCon = require("../../core/bus/_con");
	var AchCon = require("../ach/_con");
	var ClassifyCon = require("../bus.classify/_con");
	var TagCon = require("../bus.tag/_con");
	var LeagueCon = require("../league/_con");
	var BuffCon = require("../buff/_con");
	var BusUserBindCon = require("../bus_user_bind/_con");
	var BusUserCon = require("../bus_user/_con");
	var BusGuideCon = require("../bus.guide/_con");
	var CommentCon = require("../comment/_con");
	var config = require("../_include/config");
	var data_cut = require("../_include/data_cut");
	var helper = require("../_include/helper");
	var md5 = require("../_include/md5");
	var $Object = require("../_include/$.Object");
	var $Array = require("../_include/$.Array");
	var tld = require('tldjs');
	var fs = require("fs");
	var Fiber = require('fibers');
	var LBS = require("../_include/baiduLBS");
	var midEvent = require("../../middleware/index");
}());